/**
 * 
 */
package niuke;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 不想出差的hr {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String string = scanner.nextLine();
		scanner.close();
		String[] strings = string.split(",");
		int[] a = new int[strings.length];
		for (int i = 0; i < a.length; i++) {
			a[i] = Integer.parseInt(strings[i]);
		}
		int[] res = canWin(a);
		if (res[0] == -1) {
			System.out.println(1);
		} else {
			char ch = (char) ('A' + res[0]);
			System.out.println(ch + "," + res[1]);
		}
	}

	private static int[] canWin(int[] a) {
		int zeroCount = 0;
		int notZeroIndex = 0;
		int oneCount = 0;
		int onePos[] = new int[2];
		int onI = 0;
		int otherIndex = 0;// 非0非1
		for (int i = 0; i < a.length; i++) {
			if (a[i] == 0) {
				zeroCount++;
			} else {
				notZeroIndex = i;
				if (a[i] == 1) {
					oneCount++;
					onePos[onI++] = i;
				} else {
					otherIndex = i;
				}
			}
		}
		if (zeroCount == 3) {
			return new int[] { -1, -1 };
		}
		if (zeroCount == 2) {// 0,0,x
			return new int[] { notZeroIndex, a[notZeroIndex] };
		}
		if (zeroCount == 1) {
			if (oneCount == 1) {// 0,1,x,x下标otherindex
				return new int[] { otherIndex, a[otherIndex] };
			} else if (oneCount == 2) {// 0,1,1
				return new int[] { -1, -1 };
			}
		}
		if (oneCount == 3) {
			return new int[] { 0, 1 };
		}
		for (int i = 0; i < a.length; i++) {
			if (a[i] != 0) {
				int tmp = a[i];
				int k = 1;
				while (k <= tmp) {
					a[i]--;
					if (canWin(a)[0] == -1) {
						return new int[] { i, k };
					}
					k++;
				}
				a[i] = tmp;
			}
		}
		return new int[] { -1, -1 };
	}

}
